﻿<UserControl x:Class="KanbanBoard.Client.View.Views.TaskBoard.ColumnView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" xmlns:my="clr-namespace:KanbanBoard.Client.View.Views.TaskBoard" xmlns:dnd="clr-namespace:KanbanBoard.Client.View.DragAndDrop" xmlns:Converters="clr-namespace:KanbanBoard.Client.View.Converters" mc:Ignorable="d" d:DesignHeight="700" d:DesignWidth="300">
	<UserControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="../../Styles/TaskBoard.xaml" />
			</ResourceDictionary.MergedDictionaries>
            <Converters:DropCommandConverter x:Key="DropCommandConverter" />
            <Converters:DropPreviewCommandConverter x:Key="DropPreviewCommandConverter" />
		</ResourceDictionary>
	</UserControl.Resources>

	<Border Style="{StaticResource Column}">

		<toolkit:DockPanel LastChildFill="True">

			<TextBlock Text="{Binding Path=Name}" Style="{StaticResource ColumnName}" toolkit:DockPanel.Dock="Top" />

            <ItemsControl ItemsSource="{Binding Tasks}" dnd:DragAndDrop.OnDrop="{Binding DropTask, Converter={StaticResource DropCommandConverter}}" dnd:DragAndDrop.OnPreviewDrop="{Binding PreviewTaskDrop, Converter={StaticResource DropPreviewCommandConverter}}">
				<ItemsControl.ItemsPanel>
					<ItemsPanelTemplate>
						<toolkit:WrapPanel x:Name="TasksPanel" AllowDrop="True" Width="300" Background="Transparent" />
					</ItemsPanelTemplate>
				</ItemsControl.ItemsPanel>
                
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <my:TaskView />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
			</ItemsControl>


		</toolkit:DockPanel>

	</Border>
</UserControl>